// 请求拦截器处理
import type { AxiosRequest } from './types'
import { useGlobalStore } from '@/store/modules/global'

// import { useGlobalStoreWithOut } from '@/store/modules/global'

export default (config: AxiosRequest.RequestConfigAndOption) => {
  // const globalStore = useGlobalStoreWithOut()

  // 请求之前处理config
  const globalStore = useGlobalStore()
  const token = globalStore.token
  // const token = '123token'

  if (token && !config.headers!.Authorization) {
    // config.headers!.Authorization = `token` //线束
    config.headers!['token'] = `${token}`; //苍穹外卖
  }
  return config
}